import React from 'react';
import Loadable from '@loadable/component';

// 通用的过场组件
const LoadingComponent = () => {
  return <div>loading</div>;
};

// 定义 LoadableEle 组件
const LoadableEle = ({ Comp }: { Comp: React.ComponentType<any> }) => {
  const LoadableComp = Loadable(Comp);

  return (
    <React.Suspense fallback={<LoadingComponent />}>
      <LoadableComp />
    </React.Suspense>
  );
};

export default LoadableEle;